package com.message;

import java.io.Serializable;

public abstract class BasePacket implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/*头*/
	public static final byte HEAD = 0x7c;
	/*内容*/
	private final byte[] bytes;
	
	private final short cmd;
	
	private boolean isSameServer;
	
	protected BasePacket(short cmd,byte[] bytes) {
		this.cmd = cmd;
		this.bytes = bytes;
		isSameServer = true;
	}

	/**
	 * 网络包的数据
	 * @return
	 */
	public byte[] getBytes() {
		return bytes;
	}
	
	
	public short getCmd() {
		return cmd;
	}

	public boolean isSameServer() {
		return isSameServer;
	}

	public void setSameServer(boolean isSameServer) {
		this.isSameServer = isSameServer;
	}

	/**
	 * 处理消息发生异常的处理
	 * @param t 异常
	 */
	public void exceptionCaught(Throwable t){
		
	}
}
